<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let {属性名1：变量名1，属性名2：变量2...}=对象
        // 作用：声明指定的变量(赋值符号左侧对象写入所有变量)
        let obj = {
            name: "清许",
            age: 24,
            sex: "女",
            skill: ["看电影", "购物", "打羽毛球"]
        }
        // let{name:a,age:b,skill:c}=obj
        // console.log(a,b,c)

        // let { name, age, sex, skill } = obj;
        // console.log(name, age, sex, skill);

        // 不完全解构
        // 赋值的属性个数>变量
        // let { name: a, age: b, sex: c, } = obj;
        // console.log(a,b,c,)

        // 解构失败
        // 赋值的属性个数<变量
        // let {name:a,age:b,sex:c,skill:d,hobbies:e}=obj;
        // console.log(a,b,c,d,e)

        // 设置解构默认值
        let {name:a,age:b,sex:c,skill:d,hobbies:e="羽毛球"}=obj;
        console.log(a,b,c,d,e)





    </script>
</body>

</html>